from kafka import KafkaConsumer

conf = {
    'bootstrap_servers': 'ip_name:9092',
    'topic_name': 'topic_name',
    'consumer_id': 'consumer-id'
}

# print (start consumer)
consumer = KafkaConsumer(conf['topic_name'],
                        bootstrap_servers=conf['bootstrap_servers'],
                        group_id=conf['consumer_id'])

for message in consumer:
    print("%s:%d:%d: key=%s value=%s" % (message.topic, message.partition,message.offset, message.key,message.value))

# print(end consumer)